<%@ include file="/taglibs.jsp" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<head>
		<title>北京邮电大学学生党员在线学习中心</title>
		<link href="${ctx}/css/pagination.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="${ctx }/ckeditor/ckeditor.js"></script>
		<script type="text/javascript" src="${ctx}/scripts/jquery-1.6.2.js"></script>
		<script type="text/javascript" src="${ctx}/scripts/jquery-datepicker.js"></script>
		<script type="text/javascript" src="${ctx}/scripts/jquery-ui-1.8.16.custom.min.js"></script>
		<script type="text/javascript">
		function showUpload(value){
			if(value == 1) document.getElementById("newsPic").style.display="inline";
			else document.getElementById("newsPic").style.display="none";
		}
		</script>
		<script type="text/javascript">
		 function new_topic(file)
	      {
			 try
			 { 
			   var title = document.getElementById("title");
			   var editor_data = CKEDITOR.instances.content.getData();
			   var pic = document.getElementsByName("picTag");	
			   if(title.value.replace(/(^\s*)/g, "") == "")
			   {
			       alert("请输入标题!");
			       title.focus();
			       return false;
			   }
			   
			   if(editor_data==null || editor_data==""){
					alert("请输入发布的内容");
					CKEDITOR.instances.content.focus();
					return false;
				}
			   
			   var radioChoose;
			   
			   if(pic != null){
				   for(i=0;i<pic.length;i++){
					   
					   if(pic[i].checked){
						   radioChoose = pic[i].value;
					   }
				   }
			   }
			   
			   if(radioChoose==1 && !file){
				   
				   alert("必须上传图片文件");
				   
				   return false;
			   }
			   }
			   catch(e)
			   {
			       alert(e);
			       return false;
			   }
	    }
    </script>
</head>
<div id="nav_bar">
    <img id="nav_bar_left" src="../../../styles/nav_bar_left.png" alt=""/>
    <div id="welcome_label">欢迎您，&nbsp;<s:property value="#session.session_user.adminName" />!</div>
    <img id="nav_bar_seperator" src="../../../styles/nav_bar_seperator.png" alt=""/>
    <div id="nav_location">
        <img id="nav_bar_point" src="../../../styles/nav_bar_point.png" alt="" />
        <div id="nav_cur_location">当前位置：&nbsp;<a href="${ctx}/Admin_PartyNewsAction_managePartyNews">党建动态管理</a>&nbsp;&nbsp;>&nbsp;&nbsp;<a  href="${ctx}/Admin_PartyNewsAction_manageSchoolNews" >学校要闻管理</a>&nbsp;&nbsp;>&nbsp;&nbsp;发布学校要闻</div>
    </div>
    <img style="float:right; width:5px;" src="../../../styles/nav_bar_right.png" alt=""/>
    <a id="nav_logout" href="${ctx}/logoutAction_adminLogout">[安全退出]</a>
</div>

<div style="clear:both; height:20px;">&nbsp;</div>

<div style="margin-left:auto; margin-right:auto; width:96%;">
		<s:form   action="Admin_PartyNewsAction_saveNewSchoolNews" method="post" theme="simple" enctype="multipart/form-data">
		
			<table>
			<tr>
				<td >
				<b>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>
				</td>
 				<td >
 				<input type="text" name="title" id="title"  maxlength="60" style="width:99%" value=""/>
				</td>
			</tr>
			<tr>
				<td>
				<b>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>
				</td>
 				<td >
 					<ckfinder:setupCKEditor editor="content" basePath="ckfinder"/>
			        <ckeditor:editor basePath="ckeditor/" editor="content" value="请在此处填写内容，内容不能为空" /> 					
				</td>
			</tr>
		</table>
		<br>
		
		<div align="left">
				<font color=red><b>&nbsp;图片新闻：&nbsp;&nbsp;</b><s:radio list="#{1:'是',0:'否'}" theme="simple" listKey="key" listValue="value" name="picTag" value="0" onclick="showUpload(this.value);"></s:radio></font> 
				<br/>
				<div id="newsPic" style="display:none;"><font color=red><b>&nbsp;上传图片：&nbsp;&nbsp;</b></font><input type="file"  name="newsPic" id="picFile" onchange="document.getElementById('previewImageaaaaa').src=getFullPath(this);"/></div>
				
			</div>
			<div style="text-align:center;">
			<input id="posttopic" name="posttopic" type="submit"  onclick="return new_topic(this.form.newsPic.value);" value="发布" class="input-button" />&nbsp;&nbsp;&nbsp;&nbsp;
			<input id="history" name="history" type="button" class="input-button" value="返回"  onclick="window.location.href='javascript:history.go(-1);'"/>
			</div>
	</s:form>
</div>

